package com.king.juc.atomicdemo.account;

import java.math.BigDecimal;

/**
 * 保护共享资源案例演示
 *      CAS必须借助volatile才能读取到共享变量的最新值来实现[比较并交换]的效果
 * @author king
 * @date 2020/11/29 19:00
 */
public class AccountTest {
    public static void main(String[] args) {
//        Account account = new AccountUnsafe(10000);
//        Account account = new AccountSafe(10000);
//        Account account = new AccountCas(10000);
//        Account.demo(account);

        DecimalAccount.demo(new DecimalAccountCas(new BigDecimal("10000")));
    }
}
